//
//  ViewController.m
//  工厂模式
//
//  Created by flannery on 2018/12/17.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ViewController.h"
#import "ShapeFactory.h"
#import "Shape.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.
    ShapeFactory *shapeFactory = ShapeFactory.new;
    
    //获取Circle的对象，并调用draw方法
    id<Shape> shape1 = [shapeFactory getShape:@"CIRCLE"];
    
    // 获取Circle的draw方法
    [shape1 draw];
    
    // 获取Rectangle的对象，并调用它的deaw方法
    id<Shape> shape2 = [shapeFactory getShape:@"RECTANGLE"];
    
    // 调用Rectangle的draw方法
    [shape2 draw];
    
    // 获取Square的对象，并调用它的draw方法
    id<Shape> shape3 = [shapeFactory getShape:@"SQUARE"];
    // 调用Suqare的draw方法
    [shape3 draw];
}


@end
